// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import '../../../static/layui/css/layui.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'babel-polyfill'


Vue.config.productionTip = false
Vue.use(ElementUI)


/* eslint-disable no-new */
//全局配置axios
import axios from 'axios'
axios.defaults.withCredentials=true;
Vue.prototype.axios = axios;

var host="";
Vue.prototype.host=host;

function getExplorerInfo() {
            var explorer = window.navigator.userAgent.toLowerCase();
            //ie 
            if (explorer.indexOf("msie") >= 0) {
                var ver = explorer.match(/msie ([\d.]+)/)[1];
                return { type: "IE", version: ver };
            }
                //firefox 
            else if (explorer.indexOf("firefox") >= 0) {
                var ver = explorer.match(/firefox\/([\d.]+)/)[1];
                return { type: "Firefox", version: ver };
            }
                //Chrome
            else if (explorer.indexOf("chrome") >= 0) {
                var ver = explorer.match(/chrome\/([\d.]+)/)[1];
                return { type: "Chrome", version: ver };
            }
                //Opera
            else if (explorer.indexOf("opera") >= 0) {
                var ver = explorer.match(/opera.([\d.]+)/)[1];
                return { type: "Opera", version: ver };
            }
                //Safari
            else if (explorer.indexOf("Safari") >= 0) {
                var ver = explorer.match(/version\/([\d.]+)/)[1];
                return { type: "Safari", version: ver };
            }
        }
    //alert("浏览器:" + getExplorerInfo().type + "\n 版本:" + getExplorerInfo().version);
    var info=getExplorerInfo();
    if(info.type=="IE"){
    	alert(info.version);  
}

Vue.directive('focus', function (el, option) {
        var defClass = 'el-input', defTag = 'input';
        var value = option.value || true;
        if (typeof value === 'boolean')
            value = { cls: defClass, tag: defTag, foc: value };
        else
            value = { cls: value.cls || defClass, tag: value.tag || defTag, foc: value.foc || false };
        if (el.classList.contains(value.cls) && value.foc)
            el.getElementsByTagName(value.tag)[0].focus();
    });



new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
